<?PHP
require_once "../../mainfile.php";

	 $result = $xoopsDB->query( "SELECT * FROM ".$xoopsDB->prefix("program_schedule_programs")." ORDER BY start_time asc, mon DESC, tue DESC, wed DESC, thu DESC, fri DESC, sat DESC, sun DESC" ) ;
		if ($result){
			$x=0;
			while ($myrow = $xoopsDB->fetchArray($result)){
				$weekViewData[] = $myrow;
			++$x;
			}
		} 
		
for($i=0; $i < count($weekViewData); $i++){
//echo $weekViewData[$i]['ID']." - ". $weekViewData[$i]['start_time'] ." - " .$weekViewData[$i]['end_time']."<P>";
//echo date("h:i:s a m/d/y ",$weekViewData[$i]['start_time'])." - " .date("h:i:s a",$weekViewData[$i]['end_time'])."<P>";

//echo mktime(date("h",$weekViewData[$i]['start_time']),date("i",$weekViewData[$i]['start_time']),0,0,0,0) ." - ".mktime(date("h",$weekViewData[$i]['end_time']),date("i",$weekViewData[$i]['end_time']),0,0,0,0)."<P>";
//echo date("h:i:s a m/d/y ",mktime(date("h",$weekViewData[$i]['start_time']),date("i",$weekViewData[$i]['start_time']),0,0,0,0))." - " .date("h:i:s a",mktime(date("h",$weekViewData[$i]['end_time']),date("i",$weekViewData[$i]['end_time']),0,0,0,0))."<P>";
$xoopsDB->query("UPDATE " . $xoopsDB->prefix('program_schedule_programs') . " SET start_time = '".mktime(date("h",$weekViewData[$i]['start_time']),date("i",$weekViewData[$i]['start_time']),0,0,0,0)."', end_time = '".mktime(date("h",$weekViewData[$i]['end_time']),date("i",$weekViewData[$i]['end_time']),0,0,0,0)."' WHERE ID = '".$weekViewData[$i]['ID']."'");
echo "UPDATED: ".$weekViewData[$i]['title']."<P>";
}
echo "Holy Sheep Shit Batman";

?>